package com.twu.biblioteca;

import java.io.PrintStream;
import java.util.ArrayList;


public class Formatter {


    private final PrintStream outStream;

    public Formatter(PrintStream printStream) {
        this.outStream =printStream;
    }


    public static String BookFormatter(Book book) {

        return book.getIsbn() + ":" +book.getTitle()+":"+book.getAuthor();
    }

    public static String ListFormatter(ArrayList<BookRecord> bookList) {

       String temp="";
        for(BookRecord bookRecord : bookList)
        {
            temp=temp+BookFormatter(bookRecord.getBook())+"\n";
        }
        return temp;
    }
    public static String movieFormatter(Movie movie) {

        return movie.getName()+":"+movie.getYear()+":"+movie.getDirector()+":"+movie.getMovie_rating();
    }

    public static String movieListFormatter(ArrayList<MovieRecord> movieList) {

        String temp="";
        for(MovieRecord movieRecord : movieList)
        {
            temp=temp+movieFormatter(movieRecord.getMovie())+"\n";
        }
        return temp;
    }


    public void outputMessageToConsole(String message) {

             outStream.println(message);
        outStream.flush();
        //System.out.println(message);
    }
}
